package com.sky.templatehttpd;

/**
 * HTTP response redirect.
 */
public class ResponseRedirect extends Response {

    private static final String HTML_HEADER_LOCATION = "Location";
    private static final String HTML_BODY_PREURI = "<html><body><a href=\"";
    private static final String HTML_BODY_POSTURI = "\">Continue</a></body></html>";

    /**
     * Create a new response to redirect client to given uri.
     * @param uri Where to redirect client.
     */
    public ResponseRedirect(String uri) {
        super(HTTP_REDIRECT, MIME_HTML, HTML_BODY_PREURI + uri + HTML_BODY_POSTURI);
        addHeader(HTML_HEADER_LOCATION, uri);
    }
}
